package dto

import (
	"gitee.com/djaf/my-certs/app/data/dxo"
	"github.com/starter-go/base/lang"
)

// Certificate ... VO
type Certificate struct {
	ID dxo.CertificateID `json:"id"`
	Base

	DN dxo.DomainName `json:"dn"`

	CommonName string        `json:"common_name"`
	NotBefore  lang.Time     `json:"not_before"`
	NotAfter   lang.Time     `json:"not_after"`
	KeyPair    dxo.KeyPairID `json:"keypair"`

	Content lang.Base64 `json:"content"`
}

// CSR ...
type CSR struct {
	ID dxo.CSRID `json:"id"`

	Base

	DN dxo.DomainName `json:"dn"`

	Cancelled bool // 当前 CSR 被取消

	Challenge *ACMEChallenge
}

// ACMEChallenge ...
type ACMEChallenge struct {
	Todo      string
	Name      string
	Value     string
	Timeout   lang.Milliseconds
	Done      bool
	Cancelled bool // 当前挑战被取消
}
